package com.example.administrator.daggerdemo;

import android.os.Bundle;

import android.widget.Toast;


import com.example.administrator.daggerdemo.base2.base.BaseActivity;
import com.example.administrator.daggerdemo.model.network.response.LoginResponseInfo;
import com.example.administrator.daggerdemo.presenter.MainActivityPresenter;


import com.example.administrator.daggerdemo.view.IMainActivityView;




public class MainActivity extends BaseActivity implements IMainActivityView {

    MainActivityPresenter presenter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      //  setContentView(R.layout.dddd);
        initData();
        initView();
     //   rxjava();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.onDestroy();
    }

    /**
     * 登录
     */
    @Override
    public void doLogin() {
        presenter.doLogin("13243762775", "123456");
    }

    @Override
    public void loginSuccess(LoginResponseInfo loginResponseInfo) {
        Toast.makeText(this,loginResponseInfo.getUser_id(),Toast.LENGTH_SHORT).show();
    }



    @Override
    public void toast(String msg) {
        Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showProgress() {
          Toast.makeText(this,"开始请求",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void hideProgress() {
        Toast.makeText(this,"请求结束",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void msgError(String errorString) {
        Toast.makeText(this,errorString,Toast.LENGTH_SHORT).show();
    }


    @Override
    protected void initPresenter() {
        presenter=new MainActivityPresenter(this);
    }

    @Override
    public void initData() {
        super.initData();
        doLogin();
    }



    @Override
    public void initView() {

    }




}
